<script type="text/javascript">
$ (function (){
	$('#sn').autocomplete(${(type)!'[]'}, {
		max: 12,    //列表里的条目数
		minChars: 0,    //自动完成激活之前填入的最小字符
		width: 200,     //提示的宽度，溢出隐藏
             scrollHeight: 300,   //提示的高度，溢出显示滚动条
             matchContains: true,    //包含匹配，就是data参数里的数据，是否只要包含文本框里的数据就显示
             autoFill: false,    //自动填充
             formatItem: function(row, i, max) {
           	  return i + '/' + max + ':"' + row.sn + '"';
             },
             formatMatch: function(row, i, max) {
           	  return row.sn + row.sc;
             },
             formatResult: function(row) {
           	  return row.sn;
		}
	}).result(function(event, row, formatted) {
		$('#sc').val(row.sc);
	});
});
</script>

<#import "/freemarker/modeltype.ftl" as mt>
<#import "/freemarker/modeltype_entity.ftl" as mte>
<div>
	<h3 class="title"><i class="fontello-icon-th-list-1"></i> 编辑收据信息</h3>
</div>
<div class="widget" >
	<div class="widget-content">
		<form id="editinvReceiptsForm">
		<input type="hidden" id="code" name="code" value="${(invReceipts.code)!''}" />
			<table style="width:400px;"  class="table table-bordered animate2 fadeInUp">
				<tr height="40">
					<td>收据类型</td>
					<td>
						<select id="type" name="type">
						<#if ((invReceipts.type)?? && invReceipts.type = 1)>
							<option value="1" selected="selected">收款</option>
							<option value="2">付款</option>
						<#elseif ((invReceipts.type)?? && invReceipts.type = 2)>
							<option value="1">收款</option>
							<option value="2" selected="selected">付款</option>
						<#else>
							<option value="1">收款</option>
							<option value="2">付款</option>
						</#if>
						</select>
					</td>
				</tr>
				<tr>
					<td>金额</td>
					<td><input type="text" id="price" name="price" value="${(invReceipts.price)!''}"/></td>
				</tr>
				
				<tr>
					<td>结算方式</td>
					<td>
						<input  name="sn" id="sn" value="${(invReceipts.sn)!''}" type="text"/>
						<input type="hidden" name="sc" id="sc" value="${(invReceipts.sc)!''}"/>
					</td>
				</tr>
				<tr>
					<td>账号</td>
					<td>
						<div class="input-group">
							<span class="btn-group">
								<input  name="bn" id="an" value="${(invReceipts.an)!''}" size="16" type="text" readonly="readonly" style="width: 150px;"/>
								<input type="hidden" name="ac" id="ac" value="${(invReceipts.ac)!''}"/>
								<button class="btn btn-primary" type="button" title="选择单位" onclick="javascript: selectAn_invReceipts($('#ac').attr('id'), $('#an').attr('id'));"><i class="icon-search"></i></button>
							</span>
						</div>
					</td>
				</tr>
				<tr>
					<td>往来单位</td>
					<td>
						<div class="input-group">
							<span class="btn-group">
								<input  name="bn" id="bn" value="${(invReceipts.bn)!''}" size="16" type="text" readonly="readonly" style="width: 150px;"/>
								<input type="hidden" name="bc" id="bc" value="${(invReceipts.bc)!''}"/>
								<button class="btn btn-primary" type="button" title="选择单位" onclick="javascript: selectBn_invReceipts($('#bc').attr('id'), $('#bn').attr('id'));"><i class="icon-search"></i></button>
							</span>
						</div>
					</td>
				</tr>
				
				<tr height="40">
					<td colspan="2" style="text-align: center;">
					<#if (invReceipts.code)??>
						<a href="javascript:;" class="btn btn-primary" onclick="javascript: sys_load_handle('invReceipts');"><i class="fontello-icon-block"></i>&nbsp;取&nbsp;&nbsp;消</a>
					<#else>
						<a href="javascript:;" class="btn btn-info" onclick="javascript: save_invReceipts(); return false;"><i class="icon-save"></i>&nbsp;保&nbsp;&nbsp;存</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						<a href="javascript:;" class="btn btn-primary" onclick="javascript: sys_load_handle('invReceipts');"><i class="fontello-icon-block"></i>&nbsp;取&nbsp;&nbsp;消</a>
					</#if>
					</td>
				</tr>
			</table>
		</form>
	</div>
</div>